package com.hengyue.common.core.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;

@Getter
@Setter
@MappedSuperclass
public abstract class CoreBaseDataEntity extends BaseEntity {

    @JsonSerialize(using = ToStringSerializer.class)
    @GeneratedValue(generator = "SnowIdGenerator")
    @GenericGenerator(type = com.hengyue.common.utils.SnowIdGenerator.class, name = "SnowIdGenerator")
    @Id
    private Long id;

    private String code;

    private String name;


    @Override
    public String toString() {
        return this.getClass().getName() + '\'' +
                this.getId() + '\'' +
                "{" +
                "code='" + code + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
